home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / sources / timertest.cp < prev    next >
Encoding:
Text File  |  2000-06-23  |  1.9 KB  |  66 lines

  1. /*
  2.     File:        TimerTest.cp
  3.  
  4.     Contains:    TTimer is a simple timing class that could provide both 10 lap time values as well as
  5.                   final values.
  6.                   TTimerTest.cp contains the TTimer test functions.
  7.   
  8.     Written by: Kent Sandvik    
  9.  
  10.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  11.  
  12.                 You may incorporate this Apple sample source code into your program(s) without
  13.                 restriction. This Apple sample source code has been provided "AS IS" and the
  14.                 responsibility for its operation is yours. You are not permitted to redistribute
  15.                 this Apple sample source code as "Apple sample source code" after having made
  16.                 changes. If you're going to re-distribute the source, we require that you make
  17.                 it clear in the source that the code was descended from Apple sample source
  18.                 code, but that you've made changes.
  19.  
  20.     Change History (most recent first):
  21.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  22.                 
  23.  
  24. */
  25. #ifndef _TIMER_
  26. #include "Timer.h"
  27. #endif
  28.  
  29. // This simple test is testing out the TTimer class, taking lap values as well
  30. // as final values.
  31.  
  32. const kSecond = 60;                                // definition of a second
  33.  
  34.  
  35. void main(void)
  36. {
  37.     cout << "Start of TTimer test…\n";
  38.  
  39.     // create a TTimer class
  40.     TTimer myTimer;
  41.  
  42.     myTimer.Start();
  43.     Delay(kSecond * 1, NULL);                    // 1 second delay
  44.     printf("Get Lap time = %i ticks\n",myTimer.GetLap());
  45.  
  46.     myTimer.SetLap(3);                            // set the third lap counter    
  47.     Delay(kSecond * 2, NULL);
  48.     myTimer.Stop();                                // 2 second delay
  49.  
  50.     printf("Time between start and stop = %i ticks\n",myTimer.GetTicks());
  51.     printf("Or in seconds = %is\n",myTimer.GetSeconds());
  52.     printf("Lap counter 3 is = %i ticks\n",myTimer.GetLap(3));
  53.  
  54.     cout << "End of the TTimer test!\n";
  55. }
  56.  
  57.  
  58. // _________________________________________________________________________________________________________ //
  59.  
  60.  
  61. /*    Change History (most recent last):
  62.   No        Init.    Date        Comment
  63.   1            khs        12/14/92    New file
  64.   2            khs        1/3/93        Cleanup
  65. */
  66.